Documentation > CMS Template API Library > Input > ShowFormSelector(string, string, Dictionary[string, dynamic], string, string, Dictionary[string, string])

ShowFormSelector

Creates a dropdown that will show the controls associated with the currently selected form, while hiding those that are not. Unlike DropDownContainers, Form Selector Forms are loaded on-demand instead of the asset's initial load. Supports nesting, so calling ShowFormSelector within another FormSelector will work as expected.

public System.Void ShowFormSelector(string, string, Dictionary[string, dynamic], string, string, Dictionary[string, string])


Returns

Void

Parameters

NameDescriptionType
label The label of the field when displayed. System.String
fieldName The field name where the value will be stored. System.String
forms The list of forms that will appear in the drop down. The key is the display label and the value is the Input Form name, ID, or path OR an InputFormParams object. Dictionary<string, dynamic>
defaultValue Optional: The desired default form. Setting this field will set the dropdown to this value if nothing has been previously selected. System.String
firstRowLabel Optional: Creates a row in the dropdown menu with the given value, but does not associate it with a set of controls to show and hide. Selecting this value will hide all controls on the resulting form. System.String
formSelectorParams Optional: Collection of values that are made available through 'context.FormSelectorParams' in the Sub Input Forms Dictionary<string, string>

Code Example

C#

Sample:
// Forms can be referenced by path, asset id, or by name if the aspx file is in the same folder as the asset's template
// Form aspx files must have 'input' in the name
var forms = new Dictionary<string, dynamic>() {{"form one label", "path/to/form/input_one.aspx" }, { "form two label", "765432" }, { "form three label", "input_three" }};

Input.ShowFormSelector("Form Selector", "form_selector", forms);




Connect with Crownpeak